#pragma once

#include <algorithm/analytical_model/algorithm/cuda/inter_op/Data.h>
#include <algorithm/analytical_model/algorithm/cuda/inter_op/receiver/Receiver.h>

#include <tuple>
#include <array>

namespace solar::cuda
{
    class RectangleReceiver;
}

namespace solar::cuda::inter_op
{
    class RectangleReceiver : public Receiver
    {
        public:
            virtual ~RectangleReceiver() = default;
            RectangleReceiver(cudaStream_t stream = nullptr);
            RectangleReceiver(const RectangleReceiver& rectangle_receiver);

            /// @returns {t, u, v, isIntersected}
            [[nodiscard]] auto intersect(const Float3& orig, const Float3& dir) const
                -> std::tuple<float, float, float, bool>;
            void init(float pixel_per_meter_for_receiver) const override;
            void setFocusCenter() const;
            void setResolution(float pixel_per_meter_for_receiver) const override;
            [[nodiscard]] auto getVertices() const -> std::array<Float3, 4>;
            void setVertices(const std::array<Float3, 4>& vertices);
            [[nodiscard]] auto getFocusCenter(const Float3& heliostat_position) const
                -> Float3 override;
    };
} // namespace solar::cuda::inter_op
